package cn.sczc.jh.client.controller.option;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import cn.sczc.jh.client.entity.User;

/**
 * 设置相关视图
 * 
 * @author yuzhantao
 *
 */
@Controller
@RequestMapping({ "/option/index", "option" })
public class OptionViewController {
	@GetMapping("/")
	public String index(Model model) {
		Subject subject = SecurityUtils.getSubject();
		User user = (User) subject.getPrincipal();
		model.addAttribute("permissionList", user.getPermissions());
		model.addAttribute("userId", user.getId().toString());
		model.addAttribute("tenantId", user.getTenantId().toString());
		model.addAttribute("userName", user.getUsername());
		model.addAttribute("teamList", user.getTeams());
		return "forward:/option/auth/user";
	}

}
